package com.example.javabasic.sample.bootstrap;

import lombok.extern.slf4j.Slf4j;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.stereotype.Component;

/**
 * 与的InitializingBean不同，ApplicationListener监听的方式是全局性的
 * 即当所有的Bean都初始化完成后才会执行方法
 *
 * @author: cph
 * @date: 2021/11/11 19:31
 */
@Slf4j
@Component
public class ApplicationListenerTest implements ApplicationListener<ContextRefreshedEvent> {

    @Override
    public void onApplicationEvent(ContextRefreshedEvent contextRefreshedEvent) {
        log.info(">>>ApplicationListenerTest#onApplicationEvent process ...");
    }
}
